# 비동기 프로그래밍
Asynchronous Programming

# 비동기 & 동기 프로그래밍

비동기 프로그래밍

  • 태스크의 완료를 기다리지 않고 다음 코드를 실행해 나간다.

동기식 프로그래밍 Sync Flow

  • 태스크가 완료될 때까지 코드의 실행을 멈추고 기다린다.

Sync 서브루틴이 즉시 값을 반환
Async 서브루틴이 다른 수단으로 값을 반환

# 비동기 프로그래밍의 특징

  • 장점 : 대개 프로그램의 성능과 응답성을 높인다.
  • 단점 : 코드의 실행 순서가 뒤죽박죽이 된다.
    • 코드의 가독성 저하
    • 디버깅의 어려움

# 비동기 프로그래밍 기법

비동기 프로그래밍의 단점을 극복하기 위한 JavaScript 의 프로그래밍 기법들

  1. 콜백
  2. Promise
  3. 비동기 함수 Async Await
  4. async Iterator
  5. async Generator
  6. async Iterable

# Reference & Comment

  • https://gitlab.com/siots-study/topics/-/wikis/asyncronous
  • https://www.youtube.com/watch?v=JaHlR1IGLN8&list=PL7jH19IHhOLMmmjrwCi7-dMFVdoU0hhgF
  • https://helloworldjavascript.net/pages/285-async.html
  • https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
  • https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Promise/race
  • https://ko.javascript.info/async
  • https://ko.javascript.info/generators-iterators
  • https://www.bsidesoft.com/8325
  • https://www.bsidesoft.com/6037